<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>修改教育情况</title>
	<link rel="stylesheet" href="../css/style.css">
	<link rel="stylesheet" href="../css/common.css">
	<link rel="stylesheet" type="text/css" href="../css/public.css"/>
	<link rel="stylesheet" href="../css/swiper.min.css">
	<script src="../js/index1.js"></script>
	<script src="../js/jquery.js"></script>
	<script src="../js/dyselect.js"></script>
	<script src="../js/swiper.min.js"></script>
	<script src="../js/rem-config.js"></script>

</head>
<body>
<div class="tabbar">
	<a href="mine.html" class="tabbar_r">
		<img src="../images/x.png" >
	</a>
	<span>修改教育情况</span>
	<a href="" class="tabbar_c">
		<img src="../images/caidan.png" alt="">
	</a>
	<div class="clear"></div>
</div>
<div class="f_banner">
	<img src="../images/banner.jpg" alt="">
</div>
<div class="progress_bar">
	<div class="yellow"></div>
	<div class="yellow"></div>
	<div class="yellow"></div>
	<div class="yellow"></div>
</div>
<div class="phone_content">
	<ul>
		<li>
			<span>职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;业</span>
			<div class="phone_yunying1 btn1">
				<span class="reg_zhiye">关系</span>
				<img src="../images/xiaosanjiao.png" alt="">
			</div>
		</li>
		<li>
			<span>学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;历</span>
			<div class="phone_yunying1 btn2">
				<span class="reg_xueli">关系</span>
				<img src="../images/xiaosanjiao.png" alt="">
			</div>
		</li>
		<li>
			<span>毕业学校</span>
			<input type="text" placeholder="请输入学校" class="phone_num reg_xuexiao">
		</li>
		<li>
			<span>专&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;业</span>
			<input type="text" placeholder="请输入所学专业" class="phone_num reg_zy">
		</li>
		<li>
			<span>毕业年份</span>
			<input type="text" placeholder="请输入时间" class="phone_num reg_nianfen">
		</li>
	</ul>
</div>
<div class="btn_box">
	<div>上一步</div>
	<div class="next_btn">下一步</div>
</div>
<div class="msg"></div>
<div class="dialog show1">
	<div class="dialog_bg"></div>
	<div class="dialog_info">
		<ul>
			<li>java开发工程师</li>
			<li>java开发工程师</li>
			<li>java全栈开发工程师</li>
		</ul>
		<a href="javascript:;" class="dialog_btn show1_cancle">取消</a>
	</div>
</div>
<div class="dialog show2">
	<div class="dialog_bg"></div>
	<div class="dialog_info">
		<ul>
			<li>6+12个月</li>
			<li>6+18个月</li>
			<li>12个月</li>
		</ul>
		<a href="javascript:;" class="dialog_btn show2_cancle">取消</a>
	</div>
</div>
</body>
<script src="../js/index1.js"></script>
<script>
    $(function() {
        $(".btn1").click(function() {
            $(".show1").show();
            $.ajax({
                url:appPath+"zhiyeDropdownBox",
                data:"",
                dataType:'json',//服务器返回json格式数据
                type:'get',//HTTP请求类型
                success:function(res){
                    if(res.success){
                        var _list = res.data;
                        var _li = "";
                        for(var i = 0;i<_list.length;i++){
                            _li+="<li li_id="+_list[i].id+">"+_list[i].name+"</li>";

                        }
                        $(".dialog.show1 ul").html(_li);

                    }else{
                        $(".msg").show().text("获取失败！原因"+res.errorMessage);
                        setTimeout(function(){
                            $(".msg").hide("slow")
                        },2000)
                    }
                }
            });
        })
        $(".show1_cancle").click(function() {
            $(".show1").hide();
        })
        $('.btn2').click(function() {
            $(".show2").show();
            $.ajax({
                url:appPath+"xueliDropdownBox",
                data:"",
                dataType:'json',//服务器返回json格式数据
                type:'get',//HTTP请求类型
                success:function(res){
                    if(res.success){
                        var _list = res.data;
                        var _li = "";
                        for(var i = 0;i<_list.length;i++){
                            _li+="<li li_id="+_list[i].id+">"+_list[i].name+"</li>";

                        }
                        $(".dialog.show2 ul").html(_li);

                    }else{
                        $(".msg").show().text("获取失败！原因"+res.errorMessage);
                        setTimeout(function(){
                            $(".msg").hide("slow")
                        },2000)
                    }
                }
            });
        })
        $('.show2_cancle').click(function() {
            $(".show2").hide();
        })


        // 获取文字再放上去
        $(".dialog").on("click","li",function() {
            var li_text = $(this).text();
            var li_id = $(this).attr("li_id")
            if ($(this).parent().parent().parent().hasClass("show1")) {
                $(".btn1 span").text(li_text);
                //获取id属性
                $(".btn1 span").attr("li_id",li_id);


            }else{
                $(".btn2 span").text(li_text);
                $(".btn2 span").attr("li_id",li_id);
            }
            $(".dialog").hide();
        })

        $('.next_btn').click(function(){
            //验证是否为空
            if($('.reg_zhiye').text()=="关系"){
                $(".msg").show().text("不能为空");
                setTimeout(function(){
                    $(".msg").hide("slow")
                },2000)
                return false;
            };
            if($('.reg_xueli').text()=="关系"){
                $(".msg").show().text("不能为空");
                setTimeout(function(){
                    $(".msg").hide("slow")
                },2000)
                return false;
            };
            if($('.reg_xuexiao').val()=="请输入学校"){
                $(".msg").show().text("不能为空");
                setTimeout(function(){
                    $(".msg").hide("slow")
                },2000)
                return false;
            };
            $(".reg_zy").blur(function(){
                if($(this).val()=="请输入所学专业"){
                    $(".msg").show().text("不能为空");
                    $(this).focus();
                    setTimeout(function(){
                        $(".msg").hide("slow")
                    },2000)
                    return false;
                }
            });
            $(".reg_nianfen").blur(function(){
                if($(this).val()=="请输入时间"){
                    $(".msg").show().text("不能为空");
                    $(this).focus();
                    setTimeout(function(){
                        $(".msg").hide("slow")
                    },2000)
                    return false;
                }
            });
            //下拉框id
            var _zhiye = $('.reg_zhiye').attr("li_id");
            var _xueli = $('.reg_xueli').attr("li_id");
            var _xuexiao = $('.reg_xuexiao').val();
            var _zy = $('.reg_zy').val();
            var _nianfen = $('.reg_nianfen').val();
            var _data = {
                //下拉框id
                "occupation":parseInt(_zhiye),
                "education":parseInt(_xueli),
                "major":_xuexiao,
                "graduationSchool":_zy,
                "graduationYear":_nianfen
            }
            $.ajax({
                url:appPath+"education",
                data:JSON.stringify(_data),
                contentType: "application/json;charset=utf-8",
                dataType:'json',//服务器返回json格式数据
                type:'post',//HTTP请求类型
                success:function(res){
                    if(res.success){
                        $('.msg').show().text("成功！1秒后跳转页面")
                        setTimeout(function(){
                            window.location.href = "contacts.html"
                        },1000)
                    }else{
                        $('.msg').show().text("失败！原因"+res.errorMessage)
                        setTimeout(function(){
                            $('.msg').hide("slow")
                        },2000)
                    }
                },

            });

        })

    });

</script>
</html>